<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
*/
/*
	积分、余额日志
*/
defined('BY_JYA') or exit('error');
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$return=array();
if($_RQ['op']=='list'){
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$params=array('merchid'=>$_SESSION['onemerchid'],'uniacid'=>$_SESSION['uniacid']);
	$return['params']=array();
	//会员ID
	if(!empty($_RQ['type'])){
		$params['type']=intval($_RQ['type']);
		$return['params']['type']=$_RQ['type'];
	}
	//时间范围
	if($_RQ['createtime']){
		$time_range=cfc('tools')->base64_decode($_RQ['createtime'],$_SESSION['base_key_str']);
		$time_range=json_decode($time_range,true);
		$return['params']['createtime']=$time_range;
		$params['createtime between']=array($time_range['tstart'],$time_range['tend']);
	}
	$list=pdo_getslice('jy_merch3fee_nlog',$params,array($pindex,$psize),$total,array(),'','id desc');
	if($list){
		foreach($list as &$item){
			$item['member']=cfc('core')->member_show($item['mid']);
		}
	}
	$return['list']=$list?$list:array();
	$totalpage=ceil($total/$psize);
	$totalpage=intval($totalpage);
	$return['totalpage'] =$totalpage;
	$return['params']['page'] =$pindex;
	$return['htmls']=array(
		'type'=>'list',
		'tabs'=>array(
			array('op'=>'list','title'=>'日增值池'),
		),
		'list'=>array('data'=>'list','tip'=>'[满足日增值客户]：1、客户会员账户的能量值必须大于0；2、昨日的能量值增值池必须大于0','edit'=>false,'list'=>array(
			array('name'=>'member','title'=>'客户','type'=>'member'),
			array('name'=>'fee','title'=>'增值量','type'=>'string'),
			array('name'=>'type','title'=>'类型','type'=>'radio','options'=>'nlog_type'),
			array('name'=>'createtime','title'=>'创建时间','type'=>'time'),
		)),
		'search'=>array(
			array('type'=>'time_range','width'=>18,'title'=>'创建时间','name'=>'createtime','help'=>''),
		),
	);
	$return['nlog_type']=$this->nlog_type;
	exi($return);
}
if($_RQ['op'] == 'del'){
	$id=intval($_RQ['id']);
	if($id){
		pdo_delete('jy_merch3fee_nlog',array('id'=>$id,'uniacid'=>$_SESSION['uniacid']));
	}
	$del=trim($_RQ['del'],';');
	if($del){
		$del=explode(';',$del);
		foreach($del as $id){
			$id=intval($id);
			if($id){
				pdo_delete('jy_merch3fee_nlog',array('id'=>$id,'uniacid'=>$_SESSION['uniacid']));
			}
		}
	}
	exi('删除成功！');
}